#include <signal.h>
#include <iostream>
#include <unistd.h>
#include <sys/types.h>
void handler(int signal)
{
    std::cout << signal << std::endl;
    sleep(10);// 模拟处理信号操作，在这10s内只会再捕捉一次
}
int main()
{
    struct sigaction act, oact;
    sigemptyset(&act.sa_mask);// 初始化阻塞信号集
    act.sa_handler = handler;
    act.sa_flags = 0;
    sigaction(2, &act, &oact);
    while (true);
    return 0;
}